// ignore_for_file: prefer_const_constructors, use_key_in_widget_constructors, use_full_hex_values_for_flutter_colors, sized_box_for_whitespace, unnecessary_import

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:tiktokadult/assets_tool/images.dart';
import 'package:tiktokadult/hj_model/splash/ads_model.dart';
import 'package:tiktokadult/hj_utils/widget_utils.dart';
import 'package:tiktokadult/routers/jump_router.dart';
import 'package:tiktokadult/tools_base/widget/common_dialog.dart';
import 'package:tiktokadult/tools_base/widget/net_image_widget.dart';

/// 系统公告--图片公告
class SystemImageDialog extends StatelessWidget {
  final AdsInfoModel? model;

  const SystemImageDialog({this.model});

  @override
  Widget build(BuildContext context) {
    return CommonDialog(
      padding: EdgeInsets.zero,
      bgColor: Colors.transparent,
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          InkWell(
            onTap: () => pushToPageByLink(model?.href, id: model?.id),
            child: AspectRatio(
              aspectRatio: 6 / 8,
              child: NetworkImageLoader(
                imageUrl: model?.cover ?? '',
                fit: BoxFit.fitWidth,
              ),
            ),
          ),
          20.sizeBoxH,
          InkWell(
            onTap: () => Get.back(),
            child: Image.asset(
              "close_button.png".commonImgPath,
              width: 32,
            ),
          )
        ],
      ),
    );
  }
}
